<?php
/**
 * Soar Framework - Lightweight and simple to use PHP Framework
 *
 * Soar is free software and is distributed WITHOUT ANY WARRANTY
 *
 * @package Soar
 * @version 1.0 $Id: soar.bootstrap.php 2 2012-04-06 21:50:33Z shay@shayanderson.com $
 * @copyright Copyright (c) 2012 ShayAnderson.com
 * @license http://www.gnu.org/licenses/gpl.html GPL License
 * @link http://www.shayanderson.com/projects/soar-php-framework.htm
 */

/**
 * Soar Framework Bootstrap
 *
 * @package Soar
 * @author Shay Anderson 03.12
 */

/**
 * ==============================================================================
 * Directory Structure
 * ==============================================================================
 * Set environment directories - tail slash required
 * Set base directory, ex: '/var/www/example/'
 */
define('SOAR_DIR_BASE', $_SERVER['DOCUMENT_ROOT'] . '/');


/**
 * ==============================================================================
 * Autoloading
 * ==============================================================================
 * Include Soar Autloader class
 * Do not include to disable autoloading if using another autoloader
 */
require_once SOAR_DIR_BASE . '_app/lib/Soar/core/SoarAutoloader.php';

// set autoload class files
SoarAutoloader::addClassFile(array(
	'_app/lib/Soar' => array(
		'Controller',
		'Error404Controller',
		'Error500Controller',
		'View'
	),
	'_app/lib/Soar/core' => array(
		'Soar',
		'SoarConf',
		'SoarConfNode',
		'SoarController',
		'SoarDebugger',
		'SoarErrorHandler',
		'SoarRegistry',
		'SoarRequest',
		'SoarRouter',
		'SoarSingleton',
		'SoarTemplateEngine',
		'SoarView'
	),
));


/**
 * ==============================================================================
 * Configuration Settings
 * ==============================================================================
 * Set Soar configuration file
 */
Soar::confFile(SOAR_DIR_BASE . '_app/lib/Soar/soar.conf.php');

// initialize debugger
SoarDebugger::init(
	SoarConf::getInstance()->core->debugger->log,
	SoarConf::getInstance()->core->debugger->log_file,
	SoarConf::getInstance()->core->debugger->log_file_dump,
	SoarConf::getInstance()->core->debugger->log_file_max_lines
);


/**
 * ==============================================================================
 * Error Handling
 * ==============================================================================
 * Set application error handler
 */
set_error_handler(array('SoarErrorHandler', 'handle'));


?>